package org.boot.dao;

import org.boot.entity.City;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

@Component
public class MyBean {
    private final JdbcTemplate jdbcTemplate;

    public MyBean(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    public void doSomething() {
        this.jdbcTemplate.execute("insert into city(id,name,state) values(1,'sim','nink');");

        /*try {
            City c = this.jdbcTemplate.queryForObject("select * from city where id=1", City.class);
            System.out.println(c);
        } catch (Exception e) {
            e.printStackTrace();
        }*/
    }
}
